/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSky.matcher;

import org.hamcrest.CustomMatcher;

/**
 *
 * @author Rakev
 */
public class RegexMatcher<C extends String> extends CustomMatcher<C> {

    private String regex;

    public RegexMatcher(String regex) {
        super(regex);
        this.regex = regex;
    }

    @Override
    public boolean matches(Object item) {
        if (item != null) {
            return ((String) item).matches(regex);
        } else {
            return false;
        }
    }
}
